package net.thermetics.fx.services;

import java.util.Map;

import net.thermetics.fx.auth.GaeUser;
import net.thermetics.fx.model.Report;
import net.thermetics.fx.model.ReportVote;

/**
 * Specifies the Report Service object. Contains the logic and business rules for
 * handling reports.
 * @author projectmoon
 *
 */
public interface ReportService {
	/**
	 * Create a Report model object.
	 * @param id
	 * @return A Report.
	 */
	public Report createReport(String id);
	
	/**
	 * Retrieve a Report model object.
	 * @param id
	 * @return A Report, or null if none exists for the id.
	 */
	public Report getReport(String id);
	
	/**
	 * Deletes a Report model object.
	 * @param id
	 */
	public void deleteReport(String id);
	
	/**
	 * Updates a Report by persisting it.
	 * @param thread
	 * @return true if succesful, false otherwise.
	 */
	public boolean updateReport(Report thread);
	
	/**
	 * Given a Report, produces a Map of human-readable
	 * votes combinations, and the number of users that
	 * voted for them. (i.e. "Delete+Flaming => 5") 
	 * @param report
	 * @return A Map containing the vote -> user mapping.
	 */
	public Map<String, Integer> getVoteCombinations(Report report);
	
	/**
	 * Creates a new ReportVote model object for the given Report and User.
	 * The vote is set to No Violation initially. The vote is automatically
	 * added to the report.
	 * @param report
	 * @param user
	 * @return A new vote.
	 */
	public ReportVote createVote(Report report, GaeUser user);
}
